package eclant.ant.types;

import java.io.File;

import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IClasspathContainer;

import eclant.ant.types.FileSetClasspathVisitor.EntryKind;
import eclant.ant.types.FileSetClasspathVisitor.EntrySelector;

final class CompoundEntrySelector implements EntrySelector
{
	private final EntrySelector[] selectors;

	CompoundEntrySelector(EntrySelector[] selectors)
	{
		this.selectors = selectors;
	}

	@Override
	public boolean isSelected(EntryKind kind, File library, EntryKind srcKind,
			IClasspathContainer container)
	{
		for (EntrySelector selector : selectors)
			if (selector.isSelected(kind, library, srcKind, container))
				return true;
		return false;
	}

	@Override
	public boolean isSelected(EntryKind kind, IResource resource, EntryKind srcKind,
			IClasspathContainer container)
	{
		for (EntrySelector selector : selectors)
			if (selector.isSelected(kind, resource, srcKind, container))
				return true;
		return false;
	}

}
